home *** CD-ROM | disk | FTP | other *** search
/ MacTech 1 to 12 / MacTech-vol-1-12.toast / Source / MacTech® Magazine / Volume 07 - 1991 / 07.07 Jul 91 / MacLock 1.0 / CAboutMacLock.c next >
Encoding:
C/C++ Source or Header  |  1989-05-31  |  2.8 KB  |  136 lines  |  [TEXT/KAHL]

  1. /*****
  2.  * FILE:        CAboutMacLock.c
  3.  * Programmer:    Mark Bykerk Kauffman
  4.  * Date:        1/91
  5.  * Purpose:                            
  6.  *        The AboutMacLock Class is used to create one object which acts
  7.  *        as an about box for MacLock.  It displays some information in a 
  8.  *        window and waits for the user to press a key or click the mouse.
  9.  *        
  10.  * PARENTCLASS = CDirector
  11.  *
  12.  *****/
  13.  
  14. #include <Global.h>
  15. #include <OSChecks.h>
  16. #include <CDesktop.h>
  17. #include <CDecorator.h>
  18. #include <CColorWindow.h>
  19. #include <CPicture.h>
  20. #include "CAboutMacLock.h"
  21.  
  22. /* Global Variables for objects of this class.    */
  23. extern CDesktop        *gDesktop;        
  24. extern CDecorator    *gDecorator;    
  25.  
  26. /* Class Constants                     */
  27. #define        WIND_ABOUT        2000
  28. #define     Plain            0               
  29.  
  30. /* METHOD IMPLEMENTATIONS             */
  31.  
  32. /******
  33.  * IAboutMacLock
  34.  *
  35.  *        Initialize an AboutMacLock object.
  36.  *
  37.  ******/
  38.  
  39. void    CAboutMacLock::IAboutMacLock(
  40.     CBureaucrat        *itsSupervisor)
  41. {
  42.     CDirector::IDirector(itsSupervisor);
  43.     
  44.     itsWindow = new(CWindow);
  45.     itsWindow->IWindow(WIND_ABOUT, TRUE, gDesktop, this);
  46.     
  47.      gDecorator->CenterWindow(itsWindow);  
  48.     
  49.     Display();
  50. }
  51.  
  52.  
  53. /*****
  54.  * Dispose 
  55.  *
  56.  *        Release all of AboutMacLock's resourses. There's only one.
  57.  *
  58.  *****/
  59.  
  60. void    CAboutMacLock::Dispose()
  61. {
  62.     ReleaseResource(aboutscreen);
  63.     inherited::Dispose();  
  64. }
  65.  
  66.  
  67. /*****
  68.  * Display
  69.  *
  70.  *        Display the AboutMacLock box.
  71.  * 
  72.  *****/
  73.  
  74.         /*
  75.          * Wait for a key press or mouse click.
  76.          */
  77.          
  78.         static Boolean        WaitForUserEvent()
  79.         {
  80.             EventRecord        theEvent;
  81.  
  82.             while (TRUE) {
  83.                 GetNextEvent(everyEvent,&theEvent);
  84.                 switch (theEvent.what)
  85.                 {
  86.                 case keyDown:
  87.                     return(TRUE);
  88.                     break;
  89.                 case mouseDown:
  90.                     return(TRUE);
  91.                     break;                        
  92.                 }
  93.             }
  94.         }
  95.  
  96. void    CAboutMacLock::Display()
  97. {
  98.     
  99.     itsWindow->Select();
  100.     itsWindow->Prepare();
  101.     SetOrigin(-12, -12);
  102.     
  103.     TextSize(14);
  104.     MoveTo(10,20);
  105.     DrawString("\pI put many hours of work into this program, it is NOT");
  106.     MoveTo(10,40);
  107.     DrawString("\pFREE.  This is a ONE DOLLAR SHAREWARE PROGRAM.");
  108.     MoveTo(10,60);
  109.     DrawString("\pIf you find this program useful, please take the time");
  110.     MoveTo(10,80);
  111.     DrawString("\pto put ONE DOLLAR in an envelope and send it to...");
  112.     MoveTo(10,100);
  113.     TextFace(bold);
  114.     MoveTo(10,120);
  115.     DrawString("\p                Mark Kauffman");
  116.     MoveTo(10,140);
  117.     DrawString("\p                254 E. 7th Ave.");
  118.     MoveTo(10,160);
  119.     DrawString("\p                Chico, CA 95926");
  120.     TextSize(10);
  121.     TextFace(Plain);
  122.     MoveTo(10,190);
  123.     DrawString("\pINSTRUCTIONS:");
  124.     MoveTo(10,210);
  125.     DrawString("\pUse command-p or the MacLock Menu to display the ");
  126.     MoveTo(10,220);
  127.     DrawString("\pChange Passowrd Dialog.");
  128.     MoveTo(10,240);
  129.     DrawString("\pPress the LOCK button to completly lock your system");
  130.     MoveTo(10,250);
  131.     DrawString("\puntil the password is typed in followed by the ");
  132.     MoveTo(10,260);
  133.     DrawString("\pReturn key.");
  134.     WaitForUserEvent();      /* Wait for a key press or mouse click.     */
  135. }
  136.